<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<!-- Mirrored from bos.asmhackers.net/docs/mouse/docs/mouse2.html by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 07 Oct 2014 11:24:06 GMT -->
<head>
<title>Bona Fide OSDev - Mouse Hardware</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="osdev,os development, os design, operating system, tutorial, documents,  bochs, x86, intel, docs, system programming, programming, forum, chat">
<meta name="description" content="The place to go for OS Development related research. IRC Chat, Forum, Tutorials, Documents, & Downloads.">
<link href="../../../style.html" rel="stylesheet" type="text/css">
</head>

<body>

<h1>Mouse Hardware</h1>
<h2>by Tomi Engdahl</h2>
<pre>
        Serial mouse
 
Voltage levels:
Mouse takes standard RS-232C output signals (+-12V) as its input signals.
Those outputs are in +12V when mouse is operated. Mouse takes some current
>from each of the RS-232C port output lines it is connected (about 10mA).
Mouse send data to computer in levels that RS-232C receiver chip in the 
computer can uderstand as RS-232C input levels. Mouse outputs are normally
something like +-5V, 0..5V or sometimes +-12V. Mouse electronics
normally use +5V voltage.
 
 
        Microsoft serial mouse
 
Pins used:
TD, RTS and DTR are used only as power source for the mouse.
RD is used to receive data from mouse.
 
Serial data parameters: 1200bps, 7 databits, 1 stop-bit
 
Data packet format: 
Data packet is 3 byte packet. It is send to the computer every time
mouse state changes (mouse moves or keys are pressed/released).
 
        D7      D6      D5      D4      D3      D2      D1      D0
 
1.      X       1       LB      RB      Y7      Y6      X7      X6
2.      X       0       X5      X4      X3      X2      X1      X0      
3.      X       0       Y5      Y4      Y3      Y2      Y1      Y0
 
The byte marked with 1. is send first, then the others. The bit D6
in the first byte is used for syncronizing the software to mouse
packets if it goes out of sync.
 
LB is the state of the left button (0 means pressed down)
RB is the state of the right button (0 means pressed down)
X7-X0 movement in X direction since last packet (signed byte)
Y7-Y0 movement in Y direction since last packet (signed byte)
 
 
        Mouse systems mouse            
 
Serial data parameters: 1200bps, 8 databits, 1 stop-bit
 
The data is sent in 5 byte packets in following format:
 
        D7      D6      D5      D4      D3      D2      D1      D0
 
1.      1       0       0       0       0       LB      CB      RB
2.      X7      X6      X5      X4      X3      X2      X1      X0
3.      Y7      Y6      Y5      Y4      Y3      Y4      Y1      Y0
4.      
5.
 
LB is left button state (0=pressed, 1=released)
CB is center button state (0=pressed, 1=released)
RB is right button state (0=pressed, 1=released)
X7-X0 movement in X direction since last packet in signed byte 
      format (-128..+127), positive direction right
Y7-Y0 movement in Y direction since last packet in signed byte 
      format (-128..+127), positive direction up
 
The last two bytes in the packet (bytes 4 and 5) contains
information about movement data send in last packet. I have not
found exact information about those bytes. I have not also found
any use for such a information (maybe it is for syncronization 
or something like that).
</pre>
</body>
<!-- Mirrored from bos.asmhackers.net/docs/mouse/docs/mouse2.html by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 07 Oct 2014 11:24:06 GMT -->
</html>
